# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.FCM.V1.Model.WebpushConfig do
  @moduledoc """
  [Webpush protocol](https://tools.ietf.org/html/rfc8030) options.

  ## Attributes

  *   `data` (*type:* `map()`, *default:* `nil`) - Arbitrary key/value payload. If present, it will override google.firebase.fcm.v1.Message.data.
  *   `fcmOptions` (*type:* `GoogleApi.FCM.V1.Model.WebpushFcmOptions.t`, *default:* `nil`) - Options for features provided by the FCM SDK for Web.
  *   `headers` (*type:* `map()`, *default:* `nil`) - HTTP headers defined in webpush protocol. Refer to [Webpush protocol](https://tools.ietf.org/html/rfc8030#section-5) for supported headers, e.g. "TTL": "15".
  *   `notification` (*type:* `map()`, *default:* `nil`) - Web Notification options as a JSON object. Supports Notification instance properties as defined in [Web Notification API](https://developer.mozilla.org/en-US/docs/Web/API/Notification). If present, "title" and "body" fields override [google.firebase.fcm.v1.Notification.title] and [google.firebase.fcm.v1.Notification.body].
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :data => map() | nil,
          :fcmOptions => GoogleApi.FCM.V1.Model.WebpushFcmOptions.t() | nil,
          :headers => map() | nil,
          :notification => map() | nil
        }

  field(:data, type: :map)
  field(:fcmOptions, as: GoogleApi.FCM.V1.Model.WebpushFcmOptions)
  field(:headers, type: :map)
  field(:notification, type: :map)
end

defimpl Poison.Decoder, for: GoogleApi.FCM.V1.Model.WebpushConfig do
  def decode(value, options) do
    GoogleApi.FCM.V1.Model.WebpushConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.FCM.V1.Model.WebpushConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
